<!DOCTYPE html>
<html lang="en">
<head>
    <link rel="icon" href="images/index.ico">
    <meta charset="utf-8">
    <title>个人页面</title>
    <!-- Bootstrap core CSS -->
    <link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="bower_components/angular/angular.js"></script>
    <link href="./css/userInfo.css" rel="stylesheet">
    <script src="js/session.js"></script>
    <script src="./js/userInfo.js"></script>

</head>
<body ng-app="userInfoApp" ng-controller="userCtrl">
<nav class="navbar navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
                    aria-expanded="false" aria-controls="navbar"><span class="sr-only">Toggle navigation</span> <span
                    class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span></button>
            <a class="navbar-brand logo" href="home.html"><img id="logo" src="images/logo.png" alt=""/></a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav navbar-right">
                <li ng-show="hasLogin">
                    <a href="userInfo.html">Welcome {{userAccount}}</a>
                </li>
                <li ng-hide="hasLogin"><a href="login.html"><span class="glyphicon glyphicon-user"></span> 登录</a></li>
                <li ng-hide="hasLogin"><a href="register.html"><span class="glyphicon glyphicon-inbox"></span> 注册</a></li>
                <li><a href="home.html"><span class="glyphicon glyphicon-home"></span> 主页</a></li>
                <li ng-show="hasLogin"><a href="order.html"><span class="glyphicon glyphicon-th-list"></span> 我的订单</a></li>
                <li ng-show="hasLogin"><a ng-click="logOut()"><span class="glyphicon glyphicon-log-out"></span> 退出</a></li>
            </ul>
        </div>
        <!--/.nav-collapse -->
    </div>
</nav>
<div class="container" ng-controller="userInfoCtrl">
    <div class="col-md-3 sidebar">
        <div class="list-group">
            <a href="#" class="list-group-item active">个人信息</a>
            <a href="" ng-click="showAddress()" class="list-group-item">收货地址</a>
            <a href="" ng-click="showInfo()" class="list-group-item">修改密码</a>
        </div>
    </div>

    <div class="col-md-1"></div>

    <div class="col-md-6" ng-show="isShowAddress" ng-controller="addressCtrl">
        <div class="row">
            <p>Address *</p>
        </div>
        <table class="table">
            <tr  ng-repeat="address in addresses">
                <td ng-bind="address.address"></td>
                <td>
                    <div ng-switch on="address.priority">
                        <button class="btn btn-primary"  ng-switch-when="0" ng-click="ToDefaultAddress($index)">设为默认收货地址</button>
                        <button class="btn btn-primary" ng-switch-when="1" disabled>默认收货地址</button>
                    </div>
                </td>
            </tr>
        </table>

        <div class="row">
            <p>New Address *</p>
        </div>
        <div class="row">
            <input type="text" class="form-control" placeholder="新地址" ng-model="newAddress">
            <button type="button" class="btn btn-primary" ng-click="addAddress()">增加新地址</button>
        </div>
    </div>



    <div class="col-md-3" ng-show="isShowInfo" ng-controller="passwordCtrl">
        <form>
            <div class="form-group">
                <label for="account">Account *</label>
                <input class="form-control" ng-model="userAccount" readonly="readonly">
            </div>
            <div class="form-group">
                <label for="Password">Password *</label>
                <input type="password" class="form-control" name="password" placeholder="请输入密码" ng-model="password" required>
                <input type="password" class="form-control" ng-model="newPassword" placeholder="再一次输入密码" required>
            </div>
            <button type="button" class="btn btn-default" ng-click="updatePassword()">提交</button>
        </form>
    </div>

</div>

</body>
</html>